// 初始化粒子背景
document.addEventListener('DOMContentLoaded', function () {
    particlesJS('particles-js', {
        particles: {
            number: { value: 80, density: { enable: true, value_area: 800 } },
            color: { value: "#ffffff" },
            shape: { type: "circle" },
            opacity: { value: 0.3, random: true },
            size: { value: 3, random: true },
            line_linked: {
                enable: true,
                distance: 150,
                color: "#ffffff",
                opacity: 0.1,
                width: 1
            },
            move: {
                enable: true,
                speed: 2,
                direction: "none",
                random: true,
                straight: false,
                out_mode: "out",
                bounce: false
            }
        },
        interactivity: {
            detect_on: "canvas",
            events: {
                onhover: { enable: true, mode: "repulse" },
                onclick: { enable: true, mode: "push" },
                resize: true
            }
        },
        retina_detect: true
    });

    // 表单提交处理
    const loginForm = document.getElementById('loginForm');
    loginForm.addEventListener('submit', function (e) {
//        e.preventDefault();

        const username = document.getElementById('username').value;
        const password = document.getElementById('password').value;
//        console.log(username)
        // 简单验证
        if (username.trim() === '' || password.trim() === '') {
        	e.preventDefault();
            alert('用户名和密码不能为空！');
            return;
        }

    });
});